package org.example;

public class Test1 {

  public static void main(String[] args) {
      String pathString = "c:\\目录\\学习";
      if (pathString.contains("\\")) {
          pathString = pathString.replace("\\", "\\\\");
          System.out.println(pathString);

      }
  }

}
